home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / unix / volume20 / gperf / part01 next >
Encoding:
Internet Message Format  |  1989-10-18  |  56.0 KB

  1. Subject:  v20i040:  Perfect hash generator for sets of key words, Part01/05
  2. Newsgroups: comp.sources.unix
  3. Sender: sources
  4. Approved: rsalz@uunet.UU.NET
  5.  
  6. Submitted-by: "Douglas C. Schmidt" <schmidt@glacier.ics.uci.edu>
  7. Posting-number: Volume 20, Issue 40
  8. Archive-name: gperf/part01
  9.  
  10. While teaching a data structures course at University of California,
  11. Irvine, I developed a program called GPERF that generates perfect hash
  12. functions for sets of key words.  A perfect hash function is simply:
  13.  
  14.           A hash function and a data structure that allows
  15.           recognition of a key word in a set of words using
  16.           exactly 1 probe into the data structure.
  17.  
  18. The gperf.texinfo file explains how the program works, the form of the
  19. input, what options are available, and hints on choosing the best
  20. options for particular key word sets.  The texinfo file is readable
  21. both via the GNU emacs `info' command, and is also suitable for
  22. typesetting with TeX.  The texinfo.tex macros needed to run 
  23. gperf.texinfo through TeX are available in the GNU GCC release.  If 
  24. you don't have access to these please email me and I'll send them to
  25. you (about 75k).
  26.     -Doug
  27.  
  28. #! /bin/sh
  29. # This is a shell archive.  Remove anything before this line, then unpack
  30. # it by saving it into a file and typing "sh file".  To overwrite existing
  31. # files, type "sh file -c".  You can also feed this as standard input via
  32. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  33. # will see the following message at the end:
  34. #        "End of archive 1 (of 5)."
  35. # Contents:  cperf cperf/Makefile cperf/README cperf/gperf.1 cperf/src
  36. #   cperf/src/boolarray.c cperf/src/boolarray.h cperf/src/hashtable.h
  37. #   cperf/src/iterator.c cperf/src/iterator.h cperf/src/keylist.h
  38. #   cperf/src/listnode.h cperf/src/main.c cperf/src/perfect.h
  39. #   cperf/src/prototype.h cperf/src/readline.c cperf/src/readline.h
  40. #   cperf/src/stderr.c cperf/src/stderr.h cperf/src/version.c
  41. #   cperf/src/xmalloc.c cperf/tests cperf/tests/Makefile
  42. #   cperf/tests/ada.gperf cperf/tests/adapredefined.gperf
  43. #   cperf/tests/c-parse.gperf cperf/tests/c.gperf
  44. #   cperf/tests/gpc.gperf cperf/tests/gplus.gperf
  45. #   cperf/tests/modula2.gperf cperf/tests/modula3.gperf
  46. #   cperf/tests/pascal.gperf cperf/tests/test.c
  47. # Wrapped by schmidt@crimee.ics.uci.edu on Wed Oct 18 11:43:31 1989
  48. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  49. if test ! -d 'cperf' ; then
  50.     echo shar: Creating directory \"'cperf'\"
  51.     mkdir 'cperf'
  52. fi
  53. if test -f 'cperf/Makefile' -a "${1}" != "-c" ; then 
  54.   echo shar: Will not clobber existing file \"'cperf/Makefile'\"
  55. else
  56. echo shar: Extracting \"'cperf/Makefile'\" \(1304 characters\)
  57. sed "s/^X//" >'cperf/Makefile' <<'END_OF_FILE'
  58. X# Copyright (C) 1989 Free Software Foundation, Inc.
  59. X# written by Douglas C. Schmidt (schmidt@ics.uci.edu)
  60. X# 
  61. X# This file is part of GNU GPERF.
  62. X# 
  63. X# GNU GPERF is free software; you can redistribute it and/or modify
  64. X# it under the terms of the GNU General Public License as published by
  65. X# the Free Software Foundation; either version 1, or (at your option)
  66. X# any later version.
  67. X# 
  68. X# GNU GPERF is distributed in the hope that it will be useful,
  69. X# but WITHOUT ANY WARRANTY; without even the implied warranty of
  70. X# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  71. X# GNU General Public License for more details.
  72. X# 
  73. X# You should have received a copy of the GNU General Public License
  74. X# along with GNU GPERF; see the file COPYING.  If not, write to
  75. X# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 
  76. X
  77. XGPERF = ../src/gperf
  78. X
  79. Xall: gperf tests
  80. X
  81. Xgperf: 
  82. X    (cd src; $(MAKE))
  83. X
  84. Xtests: gperf
  85. X    (cd tests; $(MAKE) GPERF=$(GPERF))
  86. X
  87. Xdistrib: 
  88. X    (cd ..; rm -f cperf.tar.Z; tar cvf cperf.tar cperf; compress cperf.tar; uuencode cperf.tar.Z < cperf.tar.Z > CSHAR)
  89. X
  90. Xclean: 
  91. X    (cd src; $(MAKE) clean)
  92. X    (cd tests; $(MAKE) clean)
  93. X
  94. Xrealclean: 
  95. X    (cd src; $(MAKE) realclean)
  96. X    (cd tests; $(MAKE) clean)
  97. X    -rm -f gperf.info* gperf.?? gperf.??s gperf.log gperf.toc \
  98. X          gperf.*aux *inset.c *out gperf
  99. END_OF_FILE
  100. if test 1304 -ne `wc -c <'cperf/Makefile'`; then
  101.     echo shar: \"'cperf/Makefile'\" unpacked with wrong size!
  102. fi
  103. # end of 'cperf/Makefile'
  104. fi
  105. if test -f 'cperf/README' -a "${1}" != "-c" ; then 
  106.   echo shar: Will not clobber existing file \"'cperf/README'\"
  107. else
  108. echo shar: Extracting \"'cperf/README'\" \(1174 characters\)
  109. sed "s/^X//" >'cperf/README' <<'END_OF_FILE'
  110. XWhile teaching a data structures course at University of California,
  111. XIrvine, I developed a program called GPERF that generates perfect hash
  112. Xfunctions for sets of key words.  A perfect hash function is simply:
  113. X          A hash function and a data structure that allows
  114. X          recognition of a key word in a set of words using
  115. X          exactly 1 probe into the data structure.
  116. XThe gperf.texinfo file explains how the program works, the form of the
  117. Xinput, what options are available, and hints on choosing the best
  118. Xoptions for particular key word sets.  The texinfo file is readable
  119. Xboth via the GNU emacs `info' command, and is also suitable for
  120. Xtypesetting with TeX.  The texinfo.tex macros needed to run 
  121. Xgperf.texinfo through TeX are available in the GNU GCC release.  If 
  122. Xyou don't have access to these please email me and I'll send them to
  123. Xyou (about 75k).
  124. XThe enclosed Makefile creates the executable program ``gperf'' and
  125. Xalso runs some tests.
  126. XOutput from the GPERF program is used to recognize reserved words in
  127. Xthe GNU C, GNU C++, and GNU Pascal compilers, as well as with the GNU
  128. Xindent program.
  129. XHappy hacking!
  130. XDouglas C. Schmidt
  131. Xschmidt@ics.uci.edu
  132. END_OF_FILE
  133. if test 1174 -ne `wc -c <'cperf/README'`; then
  134.     echo shar: \"'cperf/README'\" unpacked with wrong size!
  135. fi
  136. # end of 'cperf/README'
  137. fi
  138. if test -f 'cperf/gperf.1' -a "${1}" != "-c" ; then 
  139.   echo shar: Will not clobber existing file \"'cperf/gperf.1'\"
  140. else
  141. echo shar: Extracting \"'cperf/gperf.1'\" \(722 characters\)
  142. sed "s/^X//" >'cperf/gperf.1' <<'END_OF_FILE'
  143. X.TH GPERF 1 "December 16, 1988
  144. X.UC 4
  145. X.SH NAME
  146. Xgperf \- generate a perfect hash function from a key set
  147. X.SH SYNOPSIS
  148. X.B gperf 
  149. X[ 
  150. X.B \-adghijklnoprsStv
  151. X] [ 
  152. X.I keyfile
  153. X]
  154. X.SH DESCRIPTION
  155. X
  156. X\fIgperf\fP reads a set of ``keys'' from \fIkeyfile\fP (or, by
  157. Xdefault, from the standard input) and attempts to find a non-minimal
  158. Xperfect hashing function that recognizes a member of the key set in
  159. Xconstant, i.e., O(1), time.  If such a function is found the program
  160. Xgenerates a pair of \fIC\fP source code routines that perform the
  161. Xhashing and table lookup.  All generated code is directed to the
  162. Xstandard output.
  163. X
  164. XPlease refer to the \fIgperf.texinfo\fP file for more information.
  165. XThis file is distributed with \fIgperf\fP release.
  166. END_OF_FILE
  167. if test 722 -ne `wc -c <'cperf/gperf.1'`; then
  168.     echo shar: \"'cperf/gperf.1'\" unpacked with wrong size!
  169. fi
  170. # end of 'cperf/gperf.1'
  171. fi
  172. if test ! -d 'cperf/src' ; then
  173.     echo shar: Creating directory \"'cperf/src'\"
  174.     mkdir 'cperf/src'
  175. fi
  176. if test -f 'cperf/src/boolarray.c' -a "${1}" != "-c" ; then 
  177.   echo shar: Will not clobber existing file \"'cperf/src/boolarray.c'\"
  178. else
  179. echo shar: Extracting \"'cperf/src/boolarray.c'\" \(2133 characters\)
  180. sed "s/^X//" >'cperf/src/boolarray.c' <<'END_OF_FILE'
  181. X/* Fast lookup table abstraction implemented as a Guilmette Array
  182. X   Copyright (C) 1989 Free Software Foundation, Inc.
  183. X   written by Douglas C. Schmidt (schmidt@ics.uci.edu)
  184. X
  185. XThis file is part of GNU GPERF.
  186. X
  187. XGNU GPERF is free software; you can redistribute it and/or modify
  188. Xit under the terms of the GNU General Public License as published by
  189. Xthe Free Software Foundation; either version 1, or (at your option)
  190. Xany later version.
  191. X
  192. XGNU GPERF is distributed in the hope that it will be useful,
  193. Xbut WITHOUT ANY WARRANTY; without even the implied warranty of
  194. XMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  195. XGNU General Public License for more details.
  196. X
  197. XYou should have received a copy of the GNU General Public License
  198. Xalong with GNU GPERF; see the file COPYING.  If not, write to
  199. Xthe Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  200. X
  201. X#include <stdio.h>
  202. X#include "boolarray.h"
  203. X#include "options.h"
  204. X
  205. X/* Locally visible BOOL_ARRAY object. */
  206. X
  207. Xstatic BOOL_ARRAY bool_array;
  208. X
  209. X/* Prints out debugging diagnostics. */
  210. X
  211. Xvoid
  212. Xbool_array_destroy ()
  213. X{
  214. X  if (OPTION_ENABLED (option, DEBUG))
  215. X    fprintf (stderr, "\ndumping boolean array information\nsize = %d\nend of array dump\n", 
  216. X             bool_array.size);
  217. X}
  218. X
  219. Xvoid
  220. Xbool_array_init (size)
  221. X     int size;
  222. X{
  223. X    int *xmalloc ();
  224. X  bool_array.iteration_number = 1;
  225. X  bool_array.size = size;
  226. X  bool_array.storage_array = xmalloc (size * sizeof *bool_array.storage_array);
  227. X  bzero (bool_array.storage_array, size * sizeof *bool_array.storage_array);
  228. X}
  229. X
  230. Xbool 
  231. Xlookup (index)
  232. X     int index;
  233. X{
  234. X  if (bool_array.storage_array[index] == bool_array.iteration_number)
  235. X    return 1;
  236. X  else
  237. X    {
  238. X      bool_array.storage_array[index] = bool_array.iteration_number;
  239. X      return 0;
  240. X    }
  241. X}
  242. X
  243. X/* Simple enough to reset, eh?! */
  244. X
  245. Xvoid 
  246. Xbool_array_reset ()  
  247. X{
  248. X  /* If we wrap around it's time to zero things out again!
  249. X     However, this only occurs once about every 2^31 iterations,
  250. X     so it should probably never happen! */
  251. X            
  252. X  if (bool_array.iteration_number++ == 0)
  253. X    bzero (bool_array.storage_array, bool_array.size * sizeof *bool_array.storage_array);
  254. X}
  255. END_OF_FILE
  256. if test 2133 -ne `wc -c <'cperf/src/boolarray.c'`; then
  257.     echo shar: \"'cperf/src/boolarray.c'\" unpacked with wrong size!
  258. fi
  259. # end of 'cperf/src/boolarray.c'
  260. fi
  261. if test -f 'cperf/src/boolarray.h' -a "${1}" != "-c" ; then 
  262.   echo shar: Will not clobber existing file \"'cperf/src/boolarray.h'\"
  263. else
  264. echo shar: Extracting \"'cperf/src/boolarray.h'\" \(1552 characters\)
  265. sed "s/^X//" >'cperf/src/boolarray.h' <<'END_OF_FILE'
  266. X/* Simple lookup table abstraction implemented as a Guilmette Array.
  267. X
  268. X   Copyright (C) 1989 Free Software Foundation, Inc.
  269. X   written by Douglas C. Schmidt (schmidt@ics.uci.edu)
  270. X
  271. XThis file is part of GNU GPERF.
  272. X
  273. XGNU GPERF is free software; you can redistribute it and/or modify
  274. Xit under the terms of the GNU General Public License as published by
  275. Xthe Free Software Foundation; either version 1, or (at your option)
  276. Xany later version.
  277. X
  278. XGNU GPERF is distributed in the hope that it will be useful,
  279. Xbut WITHOUT ANY WARRANTY; without even the implied warranty of
  280. XMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  281. XGNU General Public License for more details.
  282. X
  283. XYou should have received a copy of the GNU General Public License
  284. Xalong with GNU GPERF; see the file COPYING.  If not, write to
  285. Xthe Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  286. X
  287. X/* Define and implement a simple boolean array abstraction,
  288. X   uses a Guilmette array implementation to save on initialization time. */ 
  289. X
  290. X#ifndef _boolarray_h
  291. X#define _boolarray_h
  292. X#include "prototype.h"
  293. X
  294. Xtypedef struct bool_array 
  295. X{
  296. X  int *storage_array;           /* Initialization of the index space. */
  297. X  int  iteration_number;        /* Keep track of the current iteration. */
  298. X  int  size;                    /* Size of the entire array (dynamically initialized). */
  299. X} BOOL_ARRAY;
  300. X
  301. Xextern void bool_array_init P ((int size));
  302. Xextern void bool_array_destroy P ((void));
  303. Xextern bool lookup P ((int hash_value));
  304. Xextern void bool_array_reset P ((void));
  305. X
  306. X#endif /* _boolarray_h */
  307. END_OF_FILE
  308. if test 1552 -ne `wc -c <'cperf/src/boolarray.h'`; then
  309.     echo shar: \"'cperf/src/boolarray.h'\" unpacked with wrong size!
  310. fi
  311. # end of 'cperf/src/boolarray.h'
  312. fi
  313. if test -f 'cperf/src/hashtable.h' -a "${1}" != "-c" ; then 
  314.   echo shar: Will not clobber existing file \"'cperf/src/hashtable.h'\"
  315. else
  316. echo shar: Extracting \"'cperf/src/hashtable.h'\" \(1311 characters\)
  317. sed "s/^X//" >'cperf/src/hashtable.h' <<'END_OF_FILE'
  318. X/* Hash table used to check for duplicate keyword entries.
  319. X
  320. X   Copyright (C) 1989 Free Software Foundation, Inc.
  321. X   written by Douglas C. Schmidt (schmidt@ics.uci.edu)
  322. X
  323. XThis file is part of GNU GPERF.
  324. X
  325. XGNU GPERF is free software; you can redistribute it and/or modify
  326. Xit under the terms of the GNU General Public License as published by
  327. Xthe Free Software Foundation; either version 1, or (at your option)
  328. Xany later version.
  329. X
  330. XGNU GPERF is distributed in the hope that it will be useful,
  331. Xbut WITHOUT ANY WARRANTY; without even the implied warranty of
  332. XMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  333. XGNU General Public License for more details.
  334. X
  335. XYou should have received a copy of the GNU General Public License
  336. Xalong with GNU GPERF; see the file COPYING.  If not, write to
  337. Xthe Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  338. X
  339. X#ifndef _hashtable_h
  340. X#define _hashtable_h
  341. X#include "keylist.h"
  342. X#include "prototype.h"
  343. X
  344. Xtypedef struct hash_table 
  345. X{
  346. X  LIST_NODE **table; /* Vector of pointers to linked lists of List_Node's. */
  347. X  int         size;  /* Size of the vector. */
  348. X} HASH_TABLE;
  349. X
  350. Xextern void       hash_table_init P ((int size));
  351. Xextern void       hash_table_destroy P ((void));
  352. Xextern LIST_NODE *retrieve P ((LIST_NODE *item, int ignore_length));
  353. X
  354. X#endif /* _hashtable_h */
  355. END_OF_FILE
  356. if test 1311 -ne `wc -c <'cperf/src/hashtable.h'`; then
  357.     echo shar: \"'cperf/src/hashtable.h'\" unpacked with wrong size!
  358. fi
  359. # end of 'cperf/src/hashtable.h'
  360. fi
  361. if test -f 'cperf/src/iterator.c' -a "${1}" != "-c" ; then 
  362.   echo shar: Will not clobber existing file \"'cperf/src/iterator.c'\"
  363. else
  364. echo shar: Extracting \"'cperf/src/iterator.c'\" \(3043 characters\)
  365. sed "s/^X//" >'cperf/src/iterator.c' <<'END_OF_FILE'
  366. X/* Provides an Iterator for keyword characters.
  367. X   Copyright (C) 1989 Free Software Foundation, Inc.
  368. X   written by Douglas C. Schmidt (schmidt@ics.uci.edu)
  369. X
  370. XThis file is part of GNU GPERF.
  371. X
  372. XGNU GPERF is free software; you can redistribute it and/or modify
  373. Xit under the terms of the GNU General Public License as published by
  374. Xthe Free Software Foundation; either version 1, or (at your option)
  375. Xany later version.
  376. X
  377. XGNU GPERF is distributed in the hope that it will be useful,
  378. Xbut WITHOUT ANY WARRANTY; without even the implied warranty of
  379. XMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  380. XGNU General Public License for more details.
  381. X
  382. XYou should have received a copy of the GNU General Public License
  383. Xalong with GNU GPERF; see the file COPYING.  If not, write to
  384. Xthe Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  385. X
  386. X#include <stdio.h>
  387. X#include <ctype.h>
  388. X#include "iterator.h"
  389. X
  390. X/* Locally visible ITERATOR object. */
  391. X
  392. XITERATOR iterator;
  393. X
  394. X/* Constructor for ITERATOR. */
  395. X
  396. Xvoid
  397. Xiterator_init (s, lo, hi, word_end, bad_val, key_end)
  398. X     char *s;
  399. X     int lo;
  400. X     int hi;
  401. X     int word_end;
  402. X     int bad_val;
  403. X     int key_end;
  404. X{
  405. X  iterator.end         = key_end;
  406. X  iterator.error_value = bad_val;
  407. X  iterator.end_word    = word_end;
  408. X  iterator.str         = s;
  409. X  iterator.hi_bound    = hi;
  410. X  iterator.lo_bound    = lo;
  411. X}
  412. X
  413. X/* Define several useful macros to clarify subsequent code. */
  414. X#define ISPOSDIGIT(X) ((X)<='9'&&(X)>'0')
  415. X#define TODIGIT(X) ((X)-'0')
  416. X
  417. X/* Provide an Iterator, returning the ``next'' value from 
  418. X   the list of valid values given in the constructor. */
  419. X
  420. Xint 
  421. Xnext ()
  422. X{ 
  423. X/* Variables to record the Iterator's status when handling ranges, e.g., 3-12. */
  424. X
  425. X  static int size;              
  426. X  static int curr_value;           
  427. X  static int upper_bound;
  428. X
  429. X  if (size) 
  430. X    { 
  431. X      if (++curr_value >= upper_bound) 
  432. X        size = 0;    
  433. X      return curr_value; 
  434. X    }
  435. X  else 
  436. X    {
  437. X      while (*iterator.str) 
  438. X        {
  439. X          if (*iterator.str == ',') 
  440. X            iterator.str++;
  441. X          else if (*iterator.str == '$') 
  442. X            {
  443. X              iterator.str++;
  444. X              return iterator.end_word;
  445. X            }
  446. X          else if (ISPOSDIGIT (*iterator.str))
  447. X            {
  448. X
  449. X              for (curr_value = 0; isdigit (*iterator.str); iterator.str++) 
  450. X                curr_value = curr_value * 10 + *iterator.str - '0';
  451. X
  452. X              if (*iterator.str == '-') 
  453. X                {
  454. X
  455. X                  for (size = 1, upper_bound = 0; 
  456. X                       isdigit (*++iterator.str); 
  457. X                       upper_bound = upper_bound * 10 + *iterator.str - '0');
  458. X
  459. X                  if (upper_bound <= curr_value || upper_bound > iterator.hi_bound) 
  460. X                    return iterator.error_value;
  461. X                }
  462. X              return curr_value >= iterator.lo_bound && curr_value <= iterator.hi_bound 
  463. X                ? curr_value : iterator.error_value;
  464. X            }
  465. X          else
  466. X            return iterator.error_value;               
  467. X        }
  468. X
  469. X      return iterator.end;
  470. X    }
  471. X}
  472. END_OF_FILE
  473. if test 3043 -ne `wc -c <'cperf/src/iterator.c'`; then
  474.     echo shar: \"'cperf/src/iterator.c'\" unpacked with wrong size!
  475. fi
  476. # end of 'cperf/src/iterator.c'
  477. fi
  478. if test -f 'cperf/src/iterator.h' -a "${1}" != "-c" ; then 
  479.   echo shar: Will not clobber existing file \"'cperf/src/iterator.h'\"
  480. else
  481. echo shar: Extracting \"'cperf/src/iterator.h'\" \(2165 characters\)
  482. sed "s/^X//" >'cperf/src/iterator.h' <<'END_OF_FILE'
  483. X/* Provides an Iterator for keyword characters.
  484. X
  485. X   Copyright (C) 1989 Free Software Foundation, Inc.
  486. X   written by Douglas C. Schmidt (schmidt@ics.uci.edu)
  487. X
  488. XThis file is part of GNU GPERF.
  489. X
  490. XGNU GPERF is free software; you can redistribute it and/or modify
  491. Xit under the terms of the GNU General Public License as published by
  492. Xthe Free Software Foundation; either version 1, or (at your option)
  493. Xany later version.
  494. X
  495. XGNU GPERF is distributed in the hope that it will be useful,
  496. Xbut WITHOUT ANY WARRANTY; without even the implied warranty of
  497. XMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  498. XGNU General Public License for more details.
  499. X
  500. XYou should have received a copy of the GNU General Public License
  501. Xalong with GNU GPERF; see the file COPYING.  If not, write to
  502. Xthe Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  503. X
  504. X/* Provides an Iterator that expands and decodes a control string containing digits
  505. X   and ranges, returning an integer every time the generator function is called.
  506. X   This is used to decode the user's key position requests.  For example:
  507. X   "-k 1,2,5-10,$"  will return 1, 2, 5, 6, 7, 8, 9, 10, and 0 ( representing
  508. X   the abstract ``last character of the key'' on successive calls to the
  509. X   member function operator ().
  510. X   No errors are handled in these routines, they are passed back to the
  511. X   calling routines via a user-supplied Error_Value */
  512. X
  513. X#ifndef _iterator_h
  514. X#define _iterator_h
  515. X#include "prototype.h"
  516. X
  517. Xtypedef struct iterator 
  518. X{
  519. X  char *str;                    /* A pointer to the string provided by the user. */
  520. X  int   end;                    /* Value returned after last key is processed. */
  521. X  int   end_word;               /* A value marking the abstract ``end of word'' ( usually '$'). */
  522. X  int   error_value;            /* Error value returned when input is syntactically erroneous. */
  523. X  int   hi_bound;               /* Greatest possible value, inclusive. */
  524. X  int   lo_bound;               /* Smallest possible value, inclusive. */
  525. X} ITERATOR;
  526. X
  527. Xextern void iterator_init P ((char *s, int lo, int hi, int word_end, int bad_val, int key_end));
  528. Xextern int  next P ((void));
  529. X#endif /* _iterator_h */
  530. END_OF_FILE
  531. if test 2165 -ne `wc -c <'cperf/src/iterator.h'`; then
  532.     echo shar: \"'cperf/src/iterator.h'\" unpacked with wrong size!
  533. fi
  534. # end of 'cperf/src/iterator.h'
  535. fi
  536. if test -f 'cperf/src/keylist.h' -a "${1}" != "-c" ; then 
  537.   echo shar: Will not clobber existing file \"'cperf/src/keylist.h'\"
  538. else
  539. echo shar: Extracting \"'cperf/src/keylist.h'\" \(2381 characters\)
  540. sed "s/^X//" >'cperf/src/keylist.h' <<'END_OF_FILE'
  541. X/* Data and function member declarations for the keyword list class.
  542. X
  543. X   Copyright (C) 1989 Free Software Foundation, Inc.
  544. X   written by Douglas C. Schmidt (schmidt@ics.uci.edu)
  545. X
  546. XThis file is part of GNU GPERF.
  547. X
  548. XGNU GPERF is free software; you can redistribute it and/or modify
  549. Xit under the terms of the GNU General Public License as published by
  550. Xthe Free Software Foundation; either version 1, or (at your option)
  551. Xany later version.
  552. X
  553. XGNU GPERF is distributed in the hope that it will be useful,
  554. Xbut WITHOUT ANY WARRANTY; without even the implied warranty of
  555. XMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  556. XGNU General Public License for more details.
  557. X
  558. XYou should have received a copy of the GNU General Public License
  559. Xalong with GNU GPERF; see the file COPYING.  If not, write to
  560. Xthe Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  561. X
  562. X/* The key word list is a useful abstraction that keeps track of
  563. X   various pieces of information that enable that fast generation
  564. X   of the Perfect.hash function.  A Key_List is a singly-linked
  565. X   list of List_Nodes. */
  566. X
  567. X#ifndef _keylist_h
  568. X#define _keylist_h
  569. X#include <stdio.h>
  570. X#include "listnode.h"
  571. X
  572. Xtypedef struct key_list
  573. X{
  574. X  LIST_NODE *head;                  /* Points to the head of the linked list. */
  575. X  char      *array_type;            /* Pointer to the type for word list. */
  576. X  char      *return_type;           /* Pointer to return type for lookup function. */
  577. X  char      *struct_tag;            /* Shorthand for user-defined struct tag type. */
  578. X  char      *include_src;           /* C source code to be included verbatim. */
  579. X  int        list_len;              /* Length of head's Key_List, not counting duplicates. */
  580. X  int        total_keys;            /* Total number of keys, counting duplicates. */
  581. X  int        max_key_len;           /* Maximum length of the longest keyword. */
  582. X  int        min_key_len;           /* Minimum length of the shortest keyword. */
  583. X  bool       occurrence_sort;       /* True if sorting by occurrence. */
  584. X  bool       hash_sort;             /* True if sorting by hash value. */
  585. X  bool       additional_code;       /* True if any additional C code is included. */
  586. X} KEY_LIST;
  587. X
  588. Xextern void       key_list_init P ((void));
  589. Xextern void       key_list_destroy P ((void));
  590. Xextern void       print_output P ((void));
  591. Xextern KEY_LIST   key_list;
  592. X#endif /* _keylist_h */
  593. END_OF_FILE
  594. if test 2381 -ne `wc -c <'cperf/src/keylist.h'`; then
  595.     echo shar: \"'cperf/src/keylist.h'\" unpacked with wrong size!
  596. fi
  597. # end of 'cperf/src/keylist.h'
  598. fi
  599. if test -f 'cperf/src/listnode.h' -a "${1}" != "-c" ; then 
  600.   echo shar: Will not clobber existing file \"'cperf/src/listnode.h'\"
  601. else
  602. echo shar: Extracting \"'cperf/src/listnode.h'\" \(1852 characters\)
  603. sed "s/^X//" >'cperf/src/listnode.h' <<'END_OF_FILE'
  604. X/* Data and function members for defining values and operations of a list node.
  605. X
  606. X   Copyright (C) 1989 Free Software Foundation, Inc.
  607. X   written by Douglas C. Schmidt (schmidt@ics.uci.edu)
  608. X
  609. XThis file is part of GNU GPERF.
  610. X
  611. XGNU GPERF is free software; you can redistribute it and/or modify
  612. Xit under the terms of the GNU General Public License as published by
  613. Xthe Free Software Foundation; either version 1, or (at your option)
  614. Xany later version.
  615. X
  616. XGNU GPERF is distributed in the hope that it will be useful,
  617. Xbut WITHOUT ANY WARRANTY; without even the implied warranty of
  618. XMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  619. XGNU General Public License for more details.
  620. X
  621. XYou should have received a copy of the GNU General Public License
  622. Xalong with GNU GPERF; see the file COPYING.  If not, write to
  623. Xthe Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  624. X
  625. X#ifndef _listnode_h
  626. X#define _listnode_h
  627. X#include "prototype.h"
  628. X
  629. X#define ALPHABET_SIZE 128
  630. X
  631. Xtypedef struct list_node 
  632. X{ 
  633. X  char      *key;               /* Key string. */
  634. X  char      *rest;              /* Additional information for building hash function. */
  635. X  char      *key_set;           /* Set of characters to hash, specified by user. */
  636. X  char      *uniq_set;          /* The unique set of the previous characters. */
  637. X  int        length;            /* Length of the key. */
  638. X  int        hash_value;        /* Hash value for the key. */
  639. X  int        occurrence;        /* A metric for frequency of key set occurrences. */
  640. X  int        index;             /* Position of this node relative to other nodes. */
  641. X  struct list_node *link;       /* TRUE if key has an identical KEY_SET as another key. */
  642. X  struct list_node *next;       /* Points to next element on the list. */  
  643. X} LIST_NODE;
  644. X
  645. Xextern LIST_NODE *make_list_node P ((char *k, int len));
  646. X
  647. X#endif _listnode_h
  648. END_OF_FILE
  649. if test 1852 -ne `wc -c <'cperf/src/listnode.h'`; then
  650.     echo shar: \"'cperf/src/listnode.h'\" unpacked with wrong size!
  651. fi
  652. # end of 'cperf/src/listnode.h'
  653. fi
  654. if test -f 'cperf/src/main.c' -a "${1}" != "-c" ; then 
  655.   echo shar: Will not clobber existing file \"'cperf/src/main.c'\"
  656. else
  657. echo shar: Extracting \"'cperf/src/main.c'\" \(2091 characters\)
  658. sed "s/^X//" >'cperf/src/main.c' <<'END_OF_FILE'
  659. X/* Driver program for the Perfect hash function generator.
  660. X   Copyright (C) 1989 Free Software Foundation, Inc.
  661. X   written by Douglas C. Schmidt (schmidt@ics.uci.edu)
  662. X
  663. XThis file is part of GNU GPERF.
  664. X
  665. XGNU GPERF is free software; you can redistribute it and/or modify
  666. Xit under the terms of the GNU General Public License as published by
  667. Xthe Free Software Foundation; either version 1, or (at your option)
  668. Xany later version.
  669. X
  670. XGNU GPERF is distributed in the hope that it will be useful,
  671. Xbut WITHOUT ANY WARRANTY; without even the implied warranty of
  672. XMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  673. XGNU General Public License for more details.
  674. X
  675. XYou should have received a copy of the GNU General Public License
  676. Xalong with GNU GPERF; see the file COPYING.  If not, write to
  677. Xthe Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  678. X
  679. X/* Simple driver program for the Perfect.hash function generator.
  680. X   Most of the hard work is done in class Perfect and its class methods. */
  681. X
  682. X#include <stdio.h>
  683. X#include "stderr.h"
  684. X#include "options.h"
  685. X#include "perfect.h"
  686. X
  687. X/* Calls the appropriate intialization routines for each
  688. X   ADT.  Note that certain initialization routines require
  689. X   initialization *after* certain values are computed.  Therefore,
  690. X   they cannot be called here. */
  691. X   
  692. Xstatic void 
  693. Xinit_all (argc, argv)
  694. X     int argc;
  695. X     char *argv[];
  696. X{
  697. X  options_init (argc, argv);    
  698. X  key_list_init ();
  699. X  perfect_init ();              
  700. X}
  701. X
  702. X/* Calls appropriate destruction routines for each ADT.  These
  703. X   routines print diagnostics if the debugging option is enabled. */
  704. X
  705. Xstatic void
  706. Xdestroy_all ()
  707. X{
  708. X  options_destroy ();
  709. X  bool_array_destroy ();
  710. X  hash_table_destroy ();
  711. X  key_list_destroy ();
  712. X  perfect_destroy ();
  713. X}
  714. X
  715. X/* Driver for perfect hash function generation. */
  716. X
  717. Xint
  718. Xmain (argc, argv)
  719. X     int argc;
  720. X     char *argv[];
  721. X{
  722. X  int status;
  723. X  
  724. X  /* Sets the options. */
  725. X  init_all (argc, argv);
  726. X
  727. X  /* Generates the perfect hash table.
  728. X     Also prints generated code neatly to the output. */
  729. X  status = perfect_generate ();
  730. X  destroy_all ();
  731. X  return status;
  732. X}
  733. END_OF_FILE
  734. if test 2091 -ne `wc -c <'cperf/src/main.c'`; then
  735.     echo shar: \"'cperf/src/main.c'\" unpacked with wrong size!
  736. fi
  737. # end of 'cperf/src/main.c'
  738. fi
  739. if test -f 'cperf/src/perfect.h' -a "${1}" != "-c" ; then 
  740.   echo shar: Will not clobber existing file \"'cperf/src/perfect.h'\"
  741. else
  742. echo shar: Extracting \"'cperf/src/perfect.h'\" \(1717 characters\)
  743. sed "s/^X//" >'cperf/src/perfect.h' <<'END_OF_FILE'
  744. X/* Provides high-level routines to manipulate the keywork list 
  745. X   structures the code generation output. 
  746. X
  747. X   Copyright (C) 1989 Free Software Foundation, Inc.
  748. X   written by Douglas C. Schmidt (schmidt@ics.uci.edu)
  749. X
  750. XThis file is part of GNU GPERF.
  751. X
  752. XGNU GPERF is free software; you can redistribute it and/or modify
  753. Xit under the terms of the GNU General Public License as published by
  754. Xthe Free Software Foundation; either version 1, or (at your option)
  755. Xany later version.
  756. X
  757. XGNU GPERF is distributed in the hope that it will be useful,
  758. Xbut WITHOUT ANY WARRANTY; without even the implied warranty of
  759. XMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  760. XGNU General Public License for more details.
  761. X
  762. XYou should have received a copy of the GNU General Public License
  763. Xalong with GNU GPERF; see the file COPYING.  If not, write to
  764. Xthe Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  765. X
  766. X#ifndef _perfect_h
  767. X#define _perfect_h
  768. X
  769. X#include "prototype.h"
  770. X#include "keylist.h"
  771. X#include "boolarray.h"
  772. X
  773. Xtypedef struct perfect
  774. X{
  775. X  KEY_LIST   list;              /* List of key words provided by the user. */
  776. X  BOOL_ARRAY duplicate;         /* Speeds up check for redundant hash values. */
  777. X  int        max_hash_value;    /* Maximum possible hash value. */
  778. X  int        fewest_hits;       /* Records fewest # of collisions for asso value. */
  779. X  int        best_char_choice;  /* Best (but not optimal) char index found so far. */
  780. X  int        best_asso_value;   /* Best (but not optimal) asso value found so far. */
  781. X} PERFECT;
  782. X
  783. Xextern void perfect_init P ((void));
  784. Xextern void perfect_destroy P ((void));
  785. Xextern int  perfect_generate P ((void));
  786. Xextern void perfect_print P ((void));
  787. X#endif /* _perfect_h */
  788. X
  789. X
  790. END_OF_FILE
  791. if test 1717 -ne `wc -c <'cperf/src/perfect.h'`; then
  792.     echo shar: \"'cperf/src/perfect.h'\" unpacked with wrong size!
  793. fi
  794. # end of 'cperf/src/perfect.h'
  795. fi
  796. if test -f 'cperf/src/prototype.h' -a "${1}" != "-c" ; then 
  797.   echo shar: Will not clobber existing file \"'cperf/src/prototype.h'\"
  798. else
  799. echo shar: Extracting \"'cperf/src/prototype.h'\" \(234 characters\)
  800. sed "s/^X//" >'cperf/src/prototype.h' <<'END_OF_FILE'
  801. X#ifndef _prototype_h
  802. X#define _prototype_h
  803. X#ifdef __STDC__
  804. X#define P(X) X
  805. X#else
  806. X#define P(X) ()
  807. X#endif
  808. X
  809. Xtypedef char bool;
  810. X#define FALSE 0
  811. X#define TRUE 1
  812. X
  813. X#define ODD(X) ((X) & 1)
  814. X#define EVEN(X) (!((X) & 1))
  815. X#endif /* _prototype_h */
  816. END_OF_FILE
  817. if test 234 -ne `wc -c <'cperf/src/prototype.h'`; then
  818.     echo shar: \"'cperf/src/prototype.h'\" unpacked with wrong size!
  819. fi
  820. # end of 'cperf/src/prototype.h'
  821. fi
  822. if test -f 'cperf/src/readline.c' -a "${1}" != "-c" ; then 
  823.   echo shar: Will not clobber existing file \"'cperf/src/readline.c'\"
  824. else
  825. echo shar: Extracting \"'cperf/src/readline.c'\" \(2060 characters\)
  826. sed "s/^X//" >'cperf/src/readline.c' <<'END_OF_FILE'
  827. X/* Correctly reads an arbitrarily size string.
  828. X
  829. X   Copyright (C) 1989 Free Software Foundation, Inc.
  830. X   written by Douglas C. Schmidt (schmidt@ics.uci.edu)
  831. X
  832. XThis file is part of GNU GPERF.
  833. X
  834. XGNU GPERF is free software; you can redistribute it and/or modify
  835. Xit under the terms of the GNU General Public License as published by
  836. Xthe Free Software Foundation; either version 1, or (at your option)
  837. Xany later version.
  838. X
  839. XGNU GPERF is distributed in the hope that it will be useful,
  840. Xbut WITHOUT ANY WARRANTY; without even the implied warranty of
  841. XMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  842. XGNU General Public License for more details.
  843. X
  844. XYou should have received a copy of the GNU General Public License
  845. Xalong with GNU GPERF; see the file COPYING.  If not, write to
  846. Xthe Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  847. X
  848. X#include <stdio.h>
  849. X#include "readline.h"
  850. X
  851. X/* Size of each chunk. */
  852. X#define CHUNK_SIZE BUFSIZ
  853. X
  854. X/* Recursively fills up the buffer. */
  855. X
  856. Xstatic char *
  857. Xreadln_aux (chunks) 
  858. X     int chunks;
  859. X{
  860. X  char buf[CHUNK_SIZE];
  861. X  register char *bufptr = buf;
  862. X  register char *ptr;
  863. X  int c;
  864. X
  865. X  while ((c = getchar ()) != EOF && c != '\n') /* fill the current buffer */
  866. X    {
  867. X      *bufptr++ = c;
  868. X      if (bufptr - buf >= CHUNK_SIZE) /* prepend remainder to ptr buffer */
  869. X        {
  870. X          if (ptr = readln_aux (chunks + 1))
  871. X
  872. X            for (; bufptr != buf; *--ptr = *--bufptr);
  873. X
  874. X          return ptr;
  875. X        }
  876. X    }
  877. X
  878. X  if (c == EOF && bufptr == buf)
  879. X    return NULL;
  880. X
  881. X  c = (chunks * CHUNK_SIZE + bufptr - buf) + 1;
  882. X
  883. X  if (ptr = (char *) xmalloc (c))
  884. X    {
  885. X
  886. X      for (*(ptr += (c - 1)) = '\0'; bufptr != buf; *--ptr = *--bufptr)
  887. X        ;
  888. X
  889. X      return ptr;
  890. X    } 
  891. X  else 
  892. X    return NULL;
  893. X}
  894. X
  895. X/* Returns the ``next'' line, ignoring comments beginning with '#'. */
  896. X
  897. Xchar *read_line () 
  898. X{
  899. X  int c;
  900. X  if ((c = getchar ()) == '#')
  901. X    {
  902. X      while ((c = getchar ()) != '\n' && c != EOF)
  903. X        ;
  904. X
  905. X      return c != EOF ? read_line () : NULL;
  906. X    }
  907. X  else
  908. X    {
  909. X      ungetc (c, stdin);
  910. X      return readln_aux (0);
  911. X    }
  912. X}
  913. END_OF_FILE
  914. if test 2060 -ne `wc -c <'cperf/src/readline.c'`; then
  915.     echo shar: \"'cperf/src/readline.c'\" unpacked with wrong size!
  916. fi
  917. # end of 'cperf/src/readline.c'
  918. fi
  919. if test -f 'cperf/src/readline.h' -a "${1}" != "-c" ; then 
  920.   echo shar: Will not clobber existing file \"'cperf/src/readline.h'\"
  921. else
  922. echo shar: Extracting \"'cperf/src/readline.h'\" \(1160 characters\)
  923. sed "s/^X//" >'cperf/src/readline.h' <<'END_OF_FILE'
  924. X/* Reads arbitrarily long string from input file, returning it as a dynamic buffer. 
  925. X
  926. X   Copyright (C) 1989 Free Software Foundation, Inc.
  927. X   written by Douglas C. Schmidt (schmidt@ics.uci.edu)
  928. X
  929. XThis file is part of GNU GPERF.
  930. X
  931. XGNU GPERF is free software; you can redistribute it and/or modify
  932. Xit under the terms of the GNU General Public License as published by
  933. Xthe Free Software Foundation; either version 1, or (at your option)
  934. Xany later version.
  935. X
  936. XGNU GPERF is distributed in the hope that it will be useful,
  937. Xbut WITHOUT ANY WARRANTY; without even the implied warranty of
  938. XMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  939. XGNU General Public License for more details.
  940. X
  941. XYou should have received a copy of the GNU General Public License
  942. Xalong with GNU GPERF; see the file COPYING.  If not, write to
  943. Xthe Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  944. X
  945. X/* Returns a pointer to an arbitrary length string.  Returns NULL on error or EOF
  946. X   The storage for the string is dynamically allocated by new. */
  947. X
  948. X#ifndef _readline_h
  949. X#define _readline_h
  950. X#include "prototype.h"
  951. X
  952. Xextern char *read_line P ((void));
  953. X#endif /* _readline_h */
  954. X
  955. END_OF_FILE
  956. if test 1160 -ne `wc -c <'cperf/src/readline.h'`; then
  957.     echo shar: \"'cperf/src/readline.h'\" unpacked with wrong size!
  958. fi
  959. # end of 'cperf/src/readline.h'
  960. fi
  961. if test -f 'cperf/src/stderr.c' -a "${1}" != "-c" ; then 
  962.   echo shar: Will not clobber existing file \"'cperf/src/stderr.c'\"
  963. else
  964. echo shar: Extracting \"'cperf/src/stderr.c'\" \(2831 characters\)
  965. sed "s/^X//" >'cperf/src/stderr.c' <<'END_OF_FILE'
  966. X/* Provides a useful variable-length argument error handling abstraction.
  967. X
  968. X   Copyright (C) 1989 Free Software Foundation, Inc.
  969. X   written by Douglas C. Schmidt (schmidt@ics.uci.edu)
  970. X
  971. XThis file is part of GNU GPERF.
  972. X
  973. XGNU GPERF is free software; you can redistribute it and/or modify
  974. Xit under the terms of the GNU General Public License as published by
  975. Xthe Free Software Foundation; either version 1, or (at your option)
  976. Xany later version.
  977. X
  978. XGNU GPERF is distributed in the hope that it will be useful,
  979. Xbut WITHOUT ANY WARRANTY; without even the implied warranty of
  980. XMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  981. XGNU General Public License for more details.
  982. X
  983. XYou should have received a copy of the GNU General Public License
  984. Xalong with GNU GPERF; see the file COPYING.  If not, write to
  985. Xthe Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  986. X
  987. X#include <stdio.h>
  988. X#include "stderr.h"
  989. X
  990. X/* Holds the name of the currently active program. */
  991. Xstatic char *program_name;
  992. X
  993. X/* Sets name of program. */
  994. X
  995. Xvoid 
  996. Xset_program_name (prog_name)
  997. X     char *prog_name;
  998. X{ 
  999. X  program_name = prog_name;
  1000. X}
  1001. X
  1002. X/* Valid Options (prefixed by '%', as in printf format strings) include:
  1003. X   'a': exit the program at this point
  1004. X   'c': print a character
  1005. X   'd': print a decimal number
  1006. X   'e': call the function pointed to by the corresponding argument
  1007. X   'f','g': print a double
  1008. X   'n': print the name of the program (NULL if not set in constructor or elsewhere)
  1009. X   'p': print out the appropriate errno value from sys_errlist
  1010. X   's': print out a character string
  1011. X   '%': print out a single percent sign, '%' */
  1012. X
  1013. Xvoid 
  1014. Xreport_error (va_alist) 
  1015. X     va_dcl
  1016. X{
  1017. X  extern int errno, sys_nerr;
  1018. X  extern char *sys_errlist[];
  1019. X  typedef void (*PTF)();
  1020. X    typedef char *CHARP;
  1021. X  va_list argp;
  1022. X  int     abort = 0;
  1023. X  char   *format;
  1024. X
  1025. X  va_start (argp);
  1026. X
  1027. X  for (format = va_arg (argp, char *); *format; format++) 
  1028. X    {
  1029. X      if (*format != '%') 
  1030. X        putc (*format, stderr);
  1031. X      else 
  1032. X        {
  1033. X          switch(*++format) 
  1034. X            {
  1035. X            case 'a' : abort = 1; break;
  1036. X            case 'c' : putc (va_arg (argp, int), stderr); break;
  1037. X            case 'd' : fprintf (stderr, "%d", va_arg (argp, int)); break;
  1038. X            case 'e' : (*va_arg (argp, PTF))(); break;
  1039. X            case 'f' : fprintf (stderr, "%g", va_arg (argp, double)); break;
  1040. X            case 'n' : fputs (program_name ? program_name : "error", stderr); break;
  1041. X            case 'p' : 
  1042. X              if (errno < sys_nerr) 
  1043. X                fprintf (stderr, "%s: %s", va_arg (argp, CHARP), sys_errlist[errno]);
  1044. X              else 
  1045. X                fprintf (stderr, "<unknown error> %d", errno);
  1046. X              break;
  1047. X            case 's' : fputs (va_arg (argp, CHARP), stderr); break;
  1048. X            }
  1049. X        }
  1050. X      if (abort) 
  1051. X        exit (1);
  1052. X    }
  1053. X  va_end (argp);
  1054. X}
  1055. END_OF_FILE
  1056. if test 2831 -ne `wc -c <'cperf/src/stderr.c'`; then
  1057.     echo shar: \"'cperf/src/stderr.c'\" unpacked with wrong size!
  1058. fi
  1059. # end of 'cperf/src/stderr.c'
  1060. fi
  1061. if test -f 'cperf/src/stderr.h' -a "${1}" != "-c" ; then 
  1062.   echo shar: Will not clobber existing file \"'cperf/src/stderr.h'\"
  1063. else
  1064. echo shar: Extracting \"'cperf/src/stderr.h'\" \(1060 characters\)
  1065. sed "s/^X//" >'cperf/src/stderr.h' <<'END_OF_FILE'
  1066. X/* Provides a useful variable-length argument error handling abstraction.
  1067. X
  1068. X   Copyright (C) 1989 Free Software Foundation, Inc.
  1069. X   written by Douglas C. Schmidt (schmidt@ics.uci.edu)
  1070. X
  1071. XThis file is part of GNU GPERF.
  1072. X
  1073. XGNU GPERF is free software; you can redistribute it and/or modify
  1074. Xit under the terms of the GNU General Public License as published by
  1075. Xthe Free Software Foundation; either version 1, or (at your option)
  1076. Xany later version.
  1077. X
  1078. XGNU GPERF is distributed in the hope that it will be useful,
  1079. Xbut WITHOUT ANY WARRANTY; without even the implied warranty of
  1080. XMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1081. XGNU General Public License for more details.
  1082. X
  1083. XYou should have received a copy of the GNU General Public License
  1084. Xalong with GNU GPERF; see the file COPYING.  If not, write to
  1085. Xthe Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  1086. X
  1087. X#ifndef _stderr_h
  1088. X#define _stderr_h
  1089. X#include "prototype.h"
  1090. X#include <varargs.h>
  1091. X
  1092. Xextern void set_program_name P ((char *prog_name));
  1093. Xextern void report_error ();
  1094. X#endif /* _stderr_h */
  1095. END_OF_FILE
  1096. if test 1060 -ne `wc -c <'cperf/src/stderr.h'`; then
  1097.     echo shar: \"'cperf/src/stderr.h'\" unpacked with wrong size!
  1098. fi
  1099. # end of 'cperf/src/stderr.h'
  1100. fi
  1101. if test -f 'cperf/src/version.c' -a "${1}" != "-c" ; then 
  1102.   echo shar: Will not clobber existing file \"'cperf/src/version.c'\"
  1103. else
  1104. echo shar: Extracting \"'cperf/src/version.c'\" \(884 characters\)
  1105. sed "s/^X//" >'cperf/src/version.c' <<'END_OF_FILE'
  1106. X/* Current program version number.
  1107. X
  1108. X   Copyright (C) 1989 Free Software Foundation, Inc.
  1109. X   written by Douglas C. Schmidt (schmidt@ics.uci.edu)
  1110. X
  1111. XThis file is part of GNU GPERF.
  1112. X
  1113. XGNU GPERF is free software; you can redistribute it and/or modify
  1114. Xit under the terms of the GNU General Public License as published by
  1115. Xthe Free Software Foundation; either version 1, or (at your option)
  1116. Xany later version.
  1117. X
  1118. XGNU GPERF is distributed in the hope that it will be useful,
  1119. Xbut WITHOUT ANY WARRANTY; without even the implied warranty of
  1120. XMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1121. XGNU General Public License for more details.
  1122. X
  1123. XYou should have received a copy of the GNU General Public License
  1124. Xalong with GNU GPERF; see the file COPYING.  If not, write to
  1125. Xthe Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  1126. X
  1127. Xchar *version_string = "1.9.1 (K&R C version)";
  1128. END_OF_FILE
  1129. if test 884 -ne `wc -c <'cperf/src/version.c'`; then
  1130.     echo shar: \"'cperf/src/version.c'\" unpacked with wrong size!
  1131. fi
  1132. # end of 'cperf/src/version.c'
  1133. fi
  1134. if test -f 'cperf/src/xmalloc.c' -a "${1}" != "-c" ; then 
  1135.   echo shar: Will not clobber existing file \"'cperf/src/xmalloc.c'\"
  1136. else
  1137. echo shar: Extracting \"'cperf/src/xmalloc.c'\" \(1071 characters\)
  1138. sed "s/^X//" >'cperf/src/xmalloc.c' <<'END_OF_FILE'
  1139. X/* Provide a useful malloc sanity checker....
  1140. X   Copyright (C) 1989 Free Software Foundation, Inc.
  1141. X   written by Douglas C. Schmidt (schmidt@ics.uci.edu)
  1142. X
  1143. XThis file is part of GNU GPERF.
  1144. X
  1145. XGNU GPERF is free software; you can redistribute it and/or modify
  1146. Xit under the terms of the GNU General Public License as published by
  1147. Xthe Free Software Foundation; either version 1, or (at your option)
  1148. Xany later version.
  1149. X
  1150. XGNU GPERF is distributed in the hope that it will be useful,
  1151. Xbut WITHOUT ANY WARRANTY; without even the implied warranty of
  1152. XMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1153. XGNU General Public License for more details.
  1154. X
  1155. XYou should have received a copy of the GNU General Public License
  1156. Xalong with GNU GPERF; see the file COPYING.  If not, write to
  1157. Xthe Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  1158. X
  1159. X#include <stdio.h>
  1160. X
  1161. Xchar *
  1162. Xxmalloc (size)
  1163. X     int size;
  1164. X{
  1165. X  char *malloc ();
  1166. X  char *temp = malloc (size);
  1167. X  
  1168. X  if (temp == 0)
  1169. X    {
  1170. X      fprintf (stderr, "out of virtual memory\n");
  1171. X      exit (1);
  1172. X    }
  1173. X  return temp;
  1174. X}
  1175. X
  1176. END_OF_FILE
  1177. if test 1071 -ne `wc -c <'cperf/src/xmalloc.c'`; then
  1178.     echo shar: \"'cperf/src/xmalloc.c'\" unpacked with wrong size!
  1179. fi
  1180. # end of 'cperf/src/xmalloc.c'
  1181. fi
  1182. if test ! -d 'cperf/tests' ; then
  1183.     echo shar: Creating directory \"'cperf/tests'\"
  1184.     mkdir 'cperf/tests'
  1185. fi
  1186. if test -f 'cperf/tests/Makefile' -a "${1}" != "-c" ; then 
  1187.   echo shar: Will not clobber existing file \"'cperf/tests/Makefile'\"
  1188. else
  1189. echo shar: Extracting \"'cperf/tests/Makefile'\" \(2485 characters\)
  1190. sed "s/^X//" >'cperf/tests/Makefile' <<'END_OF_FILE'
  1191. X# Copyright (C) 1989 Free Software Foundation, Inc.
  1192. X# written by Douglas C. Schmidt (schmidt@ics.uci.edu)
  1193. X# 
  1194. X# This file is part of GNU GPERF.
  1195. X# 
  1196. X# GNU GPERF is free software; you can redistribute it and/or modify
  1197. X# it under the terms of the GNU General Public License as published by
  1198. X# the Free Software Foundation; either version 1, or (at your option)
  1199. X# any later version.
  1200. X# 
  1201. X# GNU GPERF is distributed in the hope that it will be useful,
  1202. X# but WITHOUT ANY WARRANTY; without even the implied warranty of
  1203. X# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1204. X# GNU General Public License for more details.
  1205. X# 
  1206. X# You should have received a copy of the GNU General Public License
  1207. X# along with GNU GPERF; see the file COPYING.  If not, write to
  1208. X# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 
  1209. X
  1210. XGPERF = gperf
  1211. XCC = gcc
  1212. X
  1213. Xall: test
  1214. X
  1215. Xtest:
  1216. X    @echo "performing some tests of the perfect hash generator"   
  1217. X    $(CC) -c -O test.c
  1218. X    $(GPERF) -p -c -l -S -C -o c.gperf > cinset.c
  1219. X    $(CC) -O -o cout cinset.c test.o
  1220. X    @echo "testing ANSI C reserved words, all items should be found in the set"
  1221. X    ./cout -v < c.gperf 
  1222. X    $(GPERF) -k1,4,'$$' ada.gperf > adainset.c
  1223. X# double '$$' is only there since make gets confused; program wants only 1 '$'
  1224. X    $(CC) -O -o aout adainset.c test.o
  1225. X    @echo "testing Ada reserved words,all items should be found in the set"
  1226. X    ./aout -v < ada.gperf 
  1227. X    $(GPERF) -p -D -k1,'$$' -s 2 -o adapredefined.gperf > preinset.c
  1228. X    $(CC) -O -o preout preinset.c test.o
  1229. X    @echo "testing Ada predefined words, all items should be found in the set"
  1230. X    ./preout -v < adapredefined.gperf 
  1231. X    $(GPERF) -k1,2,'$$' -o modula3.gperf > m3inset.c
  1232. X    $(CC) -O -o m3out m3inset.c test.o
  1233. X    @echo "testing Modula3 reserved words, all items should be found in the set"
  1234. X    ./m3out -v < modula3.gperf 
  1235. X    $(GPERF) -o -S -p < pascal.gperf > pinset.c
  1236. X    $(CC) -O -o pout pinset.c test.o
  1237. X    @echo "testing Pascal reserved words, all items should be found in the set"
  1238. X    ./pout -v < pascal.gperf     
  1239. X# these next 5 are demos that show off the generated code
  1240. X    $(GPERF) -p -j1 -g -o -t -N is_reserved_word -k1,3,'$$' c-parse.gperf
  1241. X    $(GPERF) -n -k1-8 -l modula2.gperf 
  1242. X    $(GPERF) -p -j 1 -o -a -g -t -k1,4,$$ gplus.gperf 
  1243. X    $(GPERF) -D -p -t < c-parse.gperf 
  1244. X    $(GPERF) -g -o -j1 -t -p -N is_reserved_word gpc.gperf
  1245. X# prints out the help message
  1246. X    -$(GPERF) -h 
  1247. X    @echo "only if, do, for, case, goto, else, while, and return should be found "
  1248. X    ./aout -v < c.gperf 
  1249. X
  1250. Xclean: 
  1251. X    -rm -f *.o core *~ *inset.c *out #*#
  1252. END_OF_FILE
  1253. if test 2485 -ne `wc -c <'cperf/tests/Makefile'`; then
  1254.     echo shar: \"'cperf/tests/Makefile'\" unpacked with wrong size!
  1255. fi
  1256. # end of 'cperf/tests/Makefile'
  1257. fi
  1258. if test -f 'cperf/tests/ada.gperf' -a "${1}" != "-c" ; then 
  1259.   echo shar: Will not clobber existing file \"'cperf/tests/ada.gperf'\"
  1260. else
  1261. echo shar: Extracting \"'cperf/tests/ada.gperf'\" \(366 characters\)
  1262. sed "s/^X//" >'cperf/tests/ada.gperf' <<'END_OF_FILE'
  1263. Xelse
  1264. Xexit
  1265. Xterminate
  1266. Xtype
  1267. Xraise
  1268. Xrange
  1269. Xreverse
  1270. Xdeclare
  1271. Xend
  1272. Xrecord
  1273. Xexception
  1274. Xnot
  1275. Xthen
  1276. Xreturn
  1277. Xseparate
  1278. Xselect
  1279. Xdigits
  1280. Xrenames
  1281. Xsubtype
  1282. Xelsif
  1283. Xfunction
  1284. Xfor
  1285. Xpackage
  1286. Xprocedure
  1287. Xprivate
  1288. Xwhile
  1289. Xwhen
  1290. Xnew
  1291. Xentry
  1292. Xdelay
  1293. Xcase
  1294. Xconstant
  1295. Xat
  1296. Xabort
  1297. Xaccept
  1298. Xand
  1299. Xdelta
  1300. Xaccess
  1301. Xabs
  1302. Xpragma
  1303. Xarray
  1304. Xuse
  1305. Xout
  1306. Xdo
  1307. Xothers
  1308. Xof
  1309. Xor
  1310. Xall
  1311. Xlimited
  1312. Xloop
  1313. Xnull
  1314. Xtask
  1315. Xin
  1316. Xis
  1317. Xif
  1318. Xrem
  1319. Xmod
  1320. Xbegin
  1321. Xbody
  1322. Xxor
  1323. Xgoto
  1324. Xgeneric
  1325. Xwith
  1326. END_OF_FILE
  1327. if test 366 -ne `wc -c <'cperf/tests/ada.gperf'`; then
  1328.     echo shar: \"'cperf/tests/ada.gperf'\" unpacked with wrong size!
  1329. fi
  1330. # end of 'cperf/tests/ada.gperf'
  1331. fi
  1332. if test -f 'cperf/tests/adapredefined.gperf' -a "${1}" != "-c" ; then 
  1333.   echo shar: Will not clobber existing file \"'cperf/tests/adapredefined.gperf'\"
  1334. else
  1335. echo shar: Extracting \"'cperf/tests/adapredefined.gperf'\" \(473 characters\)
  1336. sed "s/^X//" >'cperf/tests/adapredefined.gperf' <<'END_OF_FILE'
  1337. Xboolean
  1338. Xcharacter
  1339. Xconstraint_error
  1340. Xfalse
  1341. Xfloat
  1342. Xinteger
  1343. Xnatural
  1344. Xnumeric_error
  1345. Xpositive
  1346. Xprogram_error
  1347. Xstorage_error
  1348. Xstring
  1349. Xtasking_error
  1350. Xtrue
  1351. Xaddress
  1352. Xaft
  1353. Xbase
  1354. Xcallable
  1355. Xconstrained
  1356. Xcount
  1357. Xdelta
  1358. Xdigits
  1359. Xemax
  1360. Xepsilon
  1361. Xfirst
  1362. Xfirstbit
  1363. Xfore
  1364. Ximage
  1365. Xlarge
  1366. Xlast
  1367. Xlastbit
  1368. Xlength
  1369. Xmachine_emax
  1370. Xmachine_emin
  1371. Xmachine_mantissa
  1372. Xmachine_overflows
  1373. Xmachine_radix
  1374. Xmachine_rounds
  1375. Xmantissa
  1376. Xpos
  1377. Xposition
  1378. Xpred
  1379. Xrange
  1380. Xsafe_emax
  1381. Xsafe_large
  1382. Xsafe_small
  1383. Xsize
  1384. Xsmall
  1385. Xstorage_size
  1386. Xsucc
  1387. Xterminated
  1388. Xval
  1389. Xvalue
  1390. Xwidth
  1391. END_OF_FILE
  1392. if test 473 -ne `wc -c <'cperf/tests/adapredefined.gperf'`; then
  1393.     echo shar: \"'cperf/tests/adapredefined.gperf'\" unpacked with wrong size!
  1394. fi
  1395. # end of 'cperf/tests/adapredefined.gperf'
  1396. fi
  1397. if test -f 'cperf/tests/c-parse.gperf' -a "${1}" != "-c" ; then 
  1398.   echo shar: Will not clobber existing file \"'cperf/tests/c-parse.gperf'\"
  1399. else
  1400. echo shar: Extracting \"'cperf/tests/c-parse.gperf'\" \(1438 characters\)
  1401. sed "s/^X//" >'cperf/tests/c-parse.gperf' <<'END_OF_FILE'
  1402. X%{
  1403. X/* Command-line: gperf -p -j1 -g -o -t -N is_reserved_word -k1,3,$ c-parse.gperf  */
  1404. X%}
  1405. Xstruct resword { char *name; short token; enum rid rid; };
  1406. X%%
  1407. X__alignof, ALIGNOF, NORID
  1408. X__alignof__, ALIGNOF, NORID
  1409. X__asm, ASM, NORID
  1410. X__asm__, ASM, NORID
  1411. X__attribute, ATTRIBUTE, NORID
  1412. X__attribute__, ATTRIBUTE, NORID
  1413. X__const, TYPE_QUAL, RID_CONST
  1414. X__const__, TYPE_QUAL, RID_CONST
  1415. X__inline, SCSPEC, RID_INLINE
  1416. X__inline__, SCSPEC, RID_INLINE
  1417. X__signed, TYPESPEC, RID_SIGNED
  1418. X__signed__, TYPESPEC, RID_SIGNED
  1419. X__typeof, TYPEOF, NORID
  1420. X__typeof__, TYPEOF, NORID
  1421. X__volatile, TYPE_QUAL, RID_VOLATILE
  1422. X__volatile__, TYPE_QUAL, RID_VOLATILE
  1423. Xasm, ASM, NORID
  1424. Xauto, SCSPEC, RID_AUTO
  1425. Xbreak, BREAK, NORID
  1426. Xcase, CASE, NORID
  1427. Xchar, TYPESPEC, RID_CHAR
  1428. Xconst, TYPE_QUAL, RID_CONST
  1429. Xcontinue, CONTINUE, NORID
  1430. Xdefault, DEFAULT, NORID
  1431. Xdo, DO, NORID
  1432. Xdouble, TYPESPEC, RID_DOUBLE
  1433. Xelse, ELSE, NORID
  1434. Xenum, ENUM, NORID
  1435. Xextern, SCSPEC, RID_EXTERN
  1436. Xfloat, TYPESPEC, RID_FLOAT
  1437. Xfor, FOR, NORID
  1438. Xgoto, GOTO, NORID
  1439. Xif, IF, NORID
  1440. Xinline, SCSPEC, RID_INLINE
  1441. Xint, TYPESPEC, RID_INT
  1442. Xlong, TYPESPEC, RID_LONG
  1443. Xregister, SCSPEC, RID_REGISTER
  1444. Xreturn, RETURN, NORID
  1445. Xshort, TYPESPEC, RID_SHORT
  1446. Xsigned, TYPESPEC, RID_SIGNED
  1447. Xsizeof, SIZEOF, NORID
  1448. Xstatic, SCSPEC, RID_STATIC
  1449. Xstruct, STRUCT, NORID
  1450. Xswitch, SWITCH, NORID
  1451. Xtypedef, SCSPEC, RID_TYPEDEF
  1452. Xtypeof, TYPEOF, NORID
  1453. Xunion, UNION, NORID
  1454. Xunsigned, TYPESPEC, RID_UNSIGNED
  1455. Xvoid, TYPESPEC, RID_VOID
  1456. Xvolatile, TYPE_QUAL, RID_VOLATILE
  1457. Xwhile, WHILE, NORID
  1458. END_OF_FILE
  1459. if test 1438 -ne `wc -c <'cperf/tests/c-parse.gperf'`; then
  1460.     echo shar: \"'cperf/tests/c-parse.gperf'\" unpacked with wrong size!
  1461. fi
  1462. # end of 'cperf/tests/c-parse.gperf'
  1463. fi
  1464. if test -f 'cperf/tests/c.gperf' -a "${1}" != "-c" ; then 
  1465.   echo shar: Will not clobber existing file \"'cperf/tests/c.gperf'\"
  1466. else
  1467. echo shar: Extracting \"'cperf/tests/c.gperf'\" \(198 characters\)
  1468. sed "s/^X//" >'cperf/tests/c.gperf' <<'END_OF_FILE'
  1469. Xif
  1470. Xdo
  1471. Xint
  1472. Xfor
  1473. Xcase
  1474. Xchar
  1475. Xauto
  1476. Xgoto
  1477. Xelse
  1478. Xlong
  1479. Xvoid
  1480. Xenum
  1481. Xfloat
  1482. Xshort
  1483. Xunion
  1484. Xbreak
  1485. Xwhile
  1486. Xconst
  1487. Xdouble
  1488. Xstatic
  1489. Xextern
  1490. Xstruct
  1491. Xreturn
  1492. Xsizeof
  1493. Xswitch
  1494. Xsigned
  1495. Xtypedef
  1496. Xdefault
  1497. Xunsigned
  1498. Xcontinue
  1499. Xregister
  1500. Xvolatile
  1501. END_OF_FILE
  1502. if test 198 -ne `wc -c <'cperf/tests/c.gperf'`; then
  1503.     echo shar: \"'cperf/tests/c.gperf'\" unpacked with wrong size!
  1504. fi
  1505. # end of 'cperf/tests/c.gperf'
  1506. fi
  1507. if test -f 'cperf/tests/gpc.gperf' -a "${1}" != "-c" ; then 
  1508.   echo shar: Will not clobber existing file \"'cperf/tests/gpc.gperf'\"
  1509. else
  1510. echo shar: Extracting \"'cperf/tests/gpc.gperf'\" \(1122 characters\)
  1511. sed "s/^X//" >'cperf/tests/gpc.gperf' <<'END_OF_FILE'
  1512. X%{
  1513. X/* ISO Pascal 7185 reserved words.
  1514. X *
  1515. X * For GNU Pascal compiler (GPC) by jtv@hut.fi
  1516. X *
  1517. X * run this through the Doug Schmidt's gperf program
  1518. X * with command
  1519. X * gperf  -g -o -j1 -t -p -N is_reserved_word
  1520. X *
  1521. X */
  1522. X%}
  1523. Xstruct resword { char *name; short token; short iclass;};
  1524. X%%
  1525. XAnd,  AND,  PASCAL_ISO
  1526. XArray,  ARRAY,  PASCAL_ISO
  1527. XBegin,  BEGIN_, PASCAL_ISO
  1528. XCase, CASE, PASCAL_ISO
  1529. XConst,  CONST,  PASCAL_ISO
  1530. XDiv,  DIV,  PASCAL_ISO
  1531. XDo, DO, PASCAL_ISO
  1532. XDownto, DOWNTO, PASCAL_ISO
  1533. XElse, ELSE, PASCAL_ISO
  1534. XEnd,  END,  PASCAL_ISO
  1535. XFile, FILE_,  PASCAL_ISO
  1536. XFor,  FOR,  PASCAL_ISO
  1537. XFunction, FUNCTION, PASCAL_ISO
  1538. XGoto, GOTO, PASCAL_ISO
  1539. XIf, IF, PASCAL_ISO
  1540. XIn, IN, PASCAL_ISO
  1541. XLabel,  LABEL,  PASCAL_ISO
  1542. XMod,  MOD,  PASCAL_ISO
  1543. XNil,  NIL,  PASCAL_ISO
  1544. XNot,  NOT,  PASCAL_ISO
  1545. XOf, OF, PASCAL_ISO
  1546. XOr, OR, PASCAL_ISO
  1547. XPacked, PACKED, PASCAL_ISO
  1548. XProcedure, PROCEDURE, PASCAL_ISO
  1549. XProgram,PROGRAM,PASCAL_ISO
  1550. XRecord, RECORD, PASCAL_ISO
  1551. XRepeat, REPEAT, PASCAL_ISO
  1552. XSet,  SET,  PASCAL_ISO
  1553. XThen, THEN, PASCAL_ISO
  1554. XTo, TO, PASCAL_ISO
  1555. XType, TYPE, PASCAL_ISO
  1556. XUntil,  UNTIL,  PASCAL_ISO
  1557. XVar,  VAR,  PASCAL_ISO
  1558. XWhile,  WHILE,  PASCAL_ISO
  1559. XWith, WITH, PASCAL_ISO
  1560. END_OF_FILE
  1561. if test 1122 -ne `wc -c <'cperf/tests/gpc.gperf'`; then
  1562.     echo shar: \"'cperf/tests/gpc.gperf'\" unpacked with wrong size!
  1563. fi
  1564. # end of 'cperf/tests/gpc.gperf'
  1565. fi
  1566. if test -f 'cperf/tests/gplus.gperf' -a "${1}" != "-c" ; then 
  1567.   echo shar: Will not clobber existing file \"'cperf/tests/gplus.gperf'\"
  1568. else
  1569. echo shar: Extracting \"'cperf/tests/gplus.gperf'\" \(1386 characters\)
  1570. sed "s/^X//" >'cperf/tests/gplus.gperf' <<'END_OF_FILE'
  1571. Xstruct resword { char *name; short token; enum rid rid;};
  1572. X%%
  1573. Xwhile, WHILE, NORID,
  1574. Xvolatile, TYPE_QUAL, RID_VOLATILE,
  1575. Xvoid, TYPESPEC, RID_VOID,
  1576. Xvirtual, SCSPEC, RID_VIRTUAL,
  1577. Xunsigned, TYPESPEC, RID_UNSIGNED,
  1578. Xunion, AGGR, RID_UNION,
  1579. Xtypeof, TYPEOF, NORID,
  1580. Xtypedef, SCSPEC, RID_TYPEDEF,
  1581. Xthis, THIS, NORID,
  1582. Xswitch, SWITCH, NORID,
  1583. Xstruct, AGGR, RID_RECORD,
  1584. Xstatic, SCSPEC, RID_STATIC,
  1585. Xsizeof, SIZEOF, NORID,
  1586. Xsigned, TYPESPEC, RID_SIGNED,
  1587. Xshort, TYPESPEC, RID_SHORT,
  1588. Xreturn, RETURN, NORID,
  1589. Xregister, SCSPEC, RID_REGISTER,
  1590. Xpublic, PUBLIC, NORID,
  1591. Xprotected, PROTECTED, NORID,
  1592. Xprivate, PRIVATE, NORID,
  1593. Xoverload, OVERLOAD, NORID,
  1594. Xoperator, OPERATOR, NORID,
  1595. Xnew, NEW, NORID,
  1596. Xlong, TYPESPEC, RID_LONG,
  1597. Xint, TYPESPEC, RID_INT,
  1598. Xinline, SCSPEC, RID_INLINE,
  1599. Xif, IF, NORID,
  1600. Xgoto, GOTO, NORID,
  1601. Xfriend, TYPE_QUAL, RID_FRIEND,
  1602. Xfor, FOR, NORID,
  1603. Xfloat, TYPESPEC, RID_FLOAT,
  1604. Xextern, SCSPEC, RID_EXTERN,
  1605. Xenum, ENUM, NORID,
  1606. Xelse, ELSE, NORID,
  1607. Xdynamic, DYNAMIC, NORID,
  1608. Xdouble, TYPESPEC, RID_DOUBLE,
  1609. Xdo, DO, NORID,
  1610. Xdelete, DELETE, NORID,
  1611. Xdefault, DEFAULT, NORID,
  1612. Xcontinue, CONTINUE, NORID,
  1613. Xconst, TYPE_QUAL, RID_CONST,
  1614. Xclass, AGGR, RID_CLASS,
  1615. Xchar, TYPESPEC, RID_CHAR,
  1616. Xcase, CASE, NORID,
  1617. Xbreak, BREAK, NORID,
  1618. Xauto, SCSPEC, RID_AUTO,
  1619. Xasm, ASM, NORID,
  1620. X__volatile, TYPE_QUAL, RID_VOLATILE
  1621. X__typeof, TYPEOF, NORID
  1622. X__inline, SCSPEC, RID_INLINE
  1623. X__const, TYPE_QUAL, RID_CONST
  1624. X__asm, ASM, NORID
  1625. X__alignof, ALIGNOF, NORID
  1626. END_OF_FILE
  1627. if test 1386 -ne `wc -c <'cperf/tests/gplus.gperf'`; then
  1628.     echo shar: \"'cperf/tests/gplus.gperf'\" unpacked with wrong size!
  1629. fi
  1630. # end of 'cperf/tests/gplus.gperf'
  1631. fi
  1632. if test -f 'cperf/tests/modula2.gperf' -a "${1}" != "-c" ; then 
  1633.   echo shar: Will not clobber existing file \"'cperf/tests/modula2.gperf'\"
  1634. else
  1635. echo shar: Extracting \"'cperf/tests/modula2.gperf'\" \(225 characters\)
  1636. sed "s/^X//" >'cperf/tests/modula2.gperf' <<'END_OF_FILE'
  1637. XAND
  1638. XARRAY
  1639. XBEGIN
  1640. XBY
  1641. XCASE
  1642. XCONST
  1643. XDEFINITION
  1644. XDIV
  1645. XDO
  1646. XELSE
  1647. XELSIF
  1648. XEND
  1649. XEXIT
  1650. XEXPORT
  1651. XFOR
  1652. XFROM
  1653. XIF
  1654. XIMPLEMENTATION
  1655. XIMPORT
  1656. XIN
  1657. XLOOP
  1658. XMOD
  1659. XMODULE
  1660. XNOT
  1661. XOF
  1662. XOR
  1663. XPOINTER
  1664. XPROCEDURE
  1665. XQUALIFIED
  1666. XRECORD
  1667. XREPEAT
  1668. XRETURN
  1669. XSET
  1670. XTHEN
  1671. XTO
  1672. XTYPE
  1673. XUNTIL
  1674. XVAR
  1675. XWHILE
  1676. XWITH
  1677. END_OF_FILE
  1678. if test 225 -ne `wc -c <'cperf/tests/modula2.gperf'`; then
  1679.     echo shar: \"'cperf/tests/modula2.gperf'\" unpacked with wrong size!
  1680. fi
  1681. # end of 'cperf/tests/modula2.gperf'
  1682. fi
  1683. if test -f 'cperf/tests/modula3.gperf' -a "${1}" != "-c" ; then 
  1684.   echo shar: Will not clobber existing file \"'cperf/tests/modula3.gperf'\"
  1685. else
  1686. echo shar: Extracting \"'cperf/tests/modula3.gperf'\" \(608 characters\)
  1687. sed "s/^X//" >'cperf/tests/modula3.gperf' <<'END_OF_FILE'
  1688. XAND
  1689. XARRAY
  1690. XBEGIN
  1691. XBITS
  1692. XBY
  1693. XCASE
  1694. XCONST
  1695. XDIV
  1696. XDO
  1697. XELSE
  1698. XELSIF
  1699. XEND
  1700. XEVAL
  1701. XEXCEPT
  1702. XEXCEPTION
  1703. XEXIT
  1704. XEXPORTS
  1705. XFINALLY
  1706. XFOR
  1707. XFROM
  1708. XIF
  1709. XIMPORT
  1710. XINTERFACE
  1711. XIN
  1712. XINLINE
  1713. XLOCK
  1714. XMETHODS
  1715. XMOD
  1716. XMODULE
  1717. XNOT
  1718. XOBJECT
  1719. XOF
  1720. XOR
  1721. XPROCEDURE
  1722. XRAISES
  1723. XREADONLY
  1724. XRECORD
  1725. XREF
  1726. XREPEAT
  1727. XRETURN
  1728. XSET
  1729. XTHEN
  1730. XTO
  1731. XTRY
  1732. XTYPE
  1733. XTYPECASE
  1734. XUNSAFE
  1735. XUNTIL
  1736. XUNTRACED
  1737. XVALUE
  1738. XVAR
  1739. XWHILE
  1740. XWITH
  1741. Xand
  1742. Xarray
  1743. Xbegin
  1744. Xbits
  1745. Xby
  1746. Xcase
  1747. Xconst
  1748. Xdiv
  1749. Xdo
  1750. Xelse
  1751. Xelsif
  1752. Xend
  1753. Xeval
  1754. Xexcept
  1755. Xexception
  1756. Xexit
  1757. Xexports
  1758. Xfinally
  1759. Xfor
  1760. Xfrom
  1761. Xif
  1762. Ximport
  1763. Xinterface
  1764. Xin
  1765. Xinline
  1766. Xlock
  1767. Xmethods
  1768. Xmod
  1769. Xmodule
  1770. Xnot
  1771. Xobject
  1772. Xof
  1773. Xor
  1774. Xprocedure
  1775. Xraises
  1776. Xreadonly
  1777. Xrecord
  1778. Xref
  1779. Xrepeat
  1780. Xreturn
  1781. Xset
  1782. Xthen
  1783. Xto
  1784. Xtry
  1785. Xtype
  1786. Xtypecase
  1787. Xunsafe
  1788. Xuntil
  1789. Xuntraced
  1790. Xvalue
  1791. Xvar
  1792. Xwhile
  1793. Xwith
  1794. END_OF_FILE
  1795. if test 608 -ne `wc -c <'cperf/tests/modula3.gperf'`; then
  1796.     echo shar: \"'cperf/tests/modula3.gperf'\" unpacked with wrong size!
  1797. fi
  1798. # end of 'cperf/tests/modula3.gperf'
  1799. fi
  1800. if test -f 'cperf/tests/pascal.gperf' -a "${1}" != "-c" ; then 
  1801.   echo shar: Will not clobber existing file \"'cperf/tests/pascal.gperf'\"
  1802. else
  1803. echo shar: Extracting \"'cperf/tests/pascal.gperf'\" \(188 characters\)
  1804. sed "s/^X//" >'cperf/tests/pascal.gperf' <<'END_OF_FILE'
  1805. Xwith
  1806. Xarray
  1807. Xand
  1808. Xfunction
  1809. Xcase
  1810. Xvar
  1811. Xconst
  1812. Xuntil
  1813. Xthen
  1814. Xset
  1815. Xrecord
  1816. Xprogram
  1817. Xprocedure
  1818. Xor
  1819. Xpacked
  1820. Xnot
  1821. Xnil
  1822. Xlabel
  1823. Xin
  1824. Xrepeat
  1825. Xof
  1826. Xgoto
  1827. Xforward
  1828. Xfor
  1829. Xwhile
  1830. Xfile
  1831. Xelse
  1832. Xdownto
  1833. Xdo
  1834. Xdiv
  1835. Xto
  1836. Xtype
  1837. Xend
  1838. Xmod
  1839. Xbegin
  1840. Xif
  1841. END_OF_FILE
  1842. if test 188 -ne `wc -c <'cperf/tests/pascal.gperf'`; then
  1843.     echo shar: \"'cperf/tests/pascal.gperf'\" unpacked with wrong size!
  1844. fi
  1845. # end of 'cperf/tests/pascal.gperf'
  1846. fi
  1847. if test -f 'cperf/tests/test.c' -a "${1}" != "-c" ; then 
  1848.   echo shar: Will not clobber existing file \"'cperf/tests/test.c'\"
  1849. else
  1850. echo shar: Extracting \"'cperf/tests/test.c'\" \(540 characters\)
  1851. sed "s/^X//" >'cperf/tests/test.c' <<'END_OF_FILE'
  1852. X/*
  1853. X   Tests the generated perfect has function.
  1854. X   The -v option prints diagnostics as to whether a word is in 
  1855. X   the set or not.  Without -v the program is useful for timing.
  1856. X*/ 
  1857. X  
  1858. X#include <stdio.h>
  1859. X
  1860. X#define MAX_LEN 80
  1861. X
  1862. Xint 
  1863. Xmain (argc, argv) 
  1864. X     int   argc;
  1865. X     char *argv[];
  1866. X{
  1867. X  int  verbose = argc > 1 ? 1 : 0;
  1868. X  char buf[MAX_LEN];
  1869. X
  1870. X  while (gets (buf)) 
  1871. X    if (in_word_set (buf, strlen (buf)) && verbose) 
  1872. X      printf ("in word set %s\n", buf);
  1873. X    else if (verbose) 
  1874. X      printf ("NOT in word set %s\n", buf);
  1875. X
  1876. X  return 0;
  1877. X}
  1878. END_OF_FILE
  1879. if test 540 -ne `wc -c <'cperf/tests/test.c'`; then
  1880.     echo shar: \"'cperf/tests/test.c'\" unpacked with wrong size!
  1881. fi
  1882. # end of 'cperf/tests/test.c'
  1883. fi
  1884. echo shar: End of archive 1 \(of 5\).
  1885. cp /dev/null ark1isdone
  1886. MISSING=""
  1887. for I in 1 2 3 4 5 ; do
  1888.     if test ! -f ark${I}isdone ; then
  1889.     MISSING="${MISSING} ${I}"
  1890.     fi
  1891. done
  1892. if test "${MISSING}" = "" ; then
  1893.     echo You have unpacked all 5 archives.
  1894.     rm -f ark[1-9]isdone
  1895. else
  1896.     echo You still need to unpack the following archives:
  1897.     echo "        " ${MISSING}
  1898. fi
  1899. ##  End of shell archive.
  1900. exit 0
  1901.  
  1902.